package com.bytech.admin;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.EnableFeignClients;

import com.bytech.common.config.LoadBalancerConfig;

import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @Author Zhao
 * @Create 2021/8/6 15:17
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }
        , scanBasePackages = { "com.bytech.**.config", "com.bytech.**.biz", "com.bytech.**.utils" })
@EnableDiscoveryClient
@EnableFeignClients(basePackages = { "com.bytech.**.biz.service.remote" })
@LoadBalancerClients(defaultConfiguration = { LoadBalancerConfig.class })
public class BlogAdminApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(BlogAdminApplication.class, args);
    }

    @Bean
    public RestTemplate restTemplate() {
        ReentrantLock lock = new ReentrantLock();
        lock.lock();
        return new RestTemplate();
    }
}
